﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PalcoCentral.Library
{
    public class CourseType
    {
        public static readonly CourseType Inst = new CourseType("Instrumento", "Inst");
        public static readonly CourseType FormMusic = new CourseType("Formação Musical", "FormMusic");
        public static readonly CourseType ClaConj = new CourseType("Classe de Conjunto", "ClaConj");
        public static readonly CourseType Teatro = new CourseType("Teatro", "Teatro");
        public static readonly CourseType Danca = new CourseType("Dança", "Danca");
        public static readonly CourseType Circo = new CourseType("Circo", "Circo");
        public static readonly CourseType Outro = new CourseType("Outro", "Outro");
       
        public static CourseType getValue(string val){
            if (val.CompareTo(Inst.toStringDB()) == 0 || val.CompareTo(Inst.ToString()) == 0)
            {
                return Inst;
            }
            else if (val.CompareTo(FormMusic.toStringDB()) == 0 || val.CompareTo(FormMusic.ToString()) == 0)
            {
                return FormMusic;
            }
            else if (val.CompareTo(ClaConj.toStringDB()) == 0 || val.CompareTo(ClaConj.ToString()) == 0)
            {
                return ClaConj;
            }
            else if (val.CompareTo(Teatro.toStringDB()) == 0 || val.CompareTo(Teatro.ToString()) == 0)
            {
                return Teatro;
            }
            else if (val.CompareTo(Danca.toStringDB()) == 0 || val.CompareTo(Danca.ToString()) == 0)
            {
                return Danca;
            }
            else if (val.CompareTo(Circo.toStringDB()) == 0 || val.CompareTo(Circo.ToString()) == 0)
            {
                return Circo;
            }
            else
            {
                return Outro;
            }
        }

        public static IEnumerable<CourseType> Values
        {
            get
            {
                yield return Inst;
                yield return FormMusic;
                yield return ClaConj;
                yield return Teatro;
                yield return Danca;
                yield return Circo;
                yield return Outro;
            }
        }

        private readonly string name;
        private readonly string db;

        CourseType(string name, string db)
        {
            this.name = name;
            this.db = db;
        }

        public string Name { get { return name; } }

        public string NameDB { get { return db; } }

        public string toStringDB()
        {
            return db;
        }

        public override string ToString()
        {
            return name;
        }
    }
}
